#include "KEY.h"
#include <unordered_map>
#include <minwindef.h>
#include "../messagebox/messagebox.h"


void CheckToggleState(AimbotToggle& toggle) {
    static std::unordered_map<WPARAM, bool> s_lastKeyStates;
    bool current_key_state = (GetAsyncKeyState(toggle.hotkey) & 0x8000) != 0;
    bool last_key_state = s_lastKeyStates[toggle.hotkey];

    if (current_key_state != last_key_state) {

        switch (toggle.mode) {
        case targe_hole::HOLD:
            toggle.enabled = current_key_state;
            break;
        case targe_hole::TARGE:
            if (current_key_state) {
                toggle.enabled = !toggle.enabled;
            }
            break;
        case targe_hole::ALWAYS:
            break;
        }
    }
    s_lastKeyStates[toggle.hotkey] = current_key_state;
}